//
//  EGLineChartViewController.m
//  MotionLaunchDemo
//
//  Created by 程登伟 on 16/9/17.
//  Copyright © 2016年 程登伟. All rights reserved.
//

#import "EGLineChartViewController.h"
#import "EGLineChartView.h"

@interface EGLineChartViewController ()

@end

@implementation EGLineChartViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor colorWithRed:246/255.0 green:246/255.0 blue:246/255.0 alpha:1];
    
    [self createSubviews];
    
}

- (void)createSubviews{
    
    // back
    UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];
    backButton.frame = CGRectMake(20, 30, 50, 30);
    [backButton setTitle:@"关闭" forState:UIControlStateNormal];
    [backButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [backButton addTarget:self action:@selector(closeMotionVC) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:backButton];
    
    
    NSArray *dataArr = [NSArray arrayWithObjects:
                      NSStringFromCGPoint(CGPointMake(1, 3)),
                      NSStringFromCGPoint(CGPointMake(2, 5)),
                      NSStringFromCGPoint(CGPointMake(3, 3)),
                      NSStringFromCGPoint(CGPointMake(4, 4)),
                      NSStringFromCGPoint(CGPointMake(5, 10)),
                      NSStringFromCGPoint(CGPointMake(6, 8)),
                      NSStringFromCGPoint(CGPointMake(7, 9)),
                      NSStringFromCGPoint(CGPointMake(8, 4)),
                      NSStringFromCGPoint(CGPointMake(9, 6)),
                      NSStringFromCGPoint(CGPointMake(10, 1)),
                      NSStringFromCGPoint(CGPointMake(11, 8)),
                      nil];
    
    EGLineChartView *lineCV = [EGLineChartView showLineChartViewFrame:CGRectMake(10, 150, self.view.frame.size.width - 20, 300) dataArr:dataArr];
    [self.view addSubview:lineCV];
    
}

-(void)closeMotionVC{
    
    [self dismissViewControllerAnimated:YES completion:nil];
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
